package com.pxl.bi.bizmq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

import static com.pxl.bi.common.BiMqConstant.*;

/**
 * 发布者
 */
@Component
public class BiMessageProducer {

    @Resource
    private RabbitTemplate rabbitTemplate;
    /**
     * 发送消息给BI消息队列
     * @param message
     */
    public void sendMessageToBI(String message){
        rabbitTemplate.convertAndSend(BI_EXCHANGE_NAME, BI_ROUTING_KEY, message);
    }

    /**
     * 发送消息给死信消息队列
     * @param message
     */
    public void sendMessageToDLX(String message){
        rabbitTemplate.convertAndSend(DLX_EXCHANGE_NAME,"" , message);
    }
}
